//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.eResearch.RuntimeServices.Logging
{
    using System.Globalization;
    using NLog;

    public class NLogLoggingService : LoggingServiceBase
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public override void Log(string level, string message)
        {
            string lvl = level.Trim().ToLower(CultureInfo.CurrentUICulture);
            if (lvl == "trace")
            {
                logger.Trace(message);
            }

            if (lvl == "debug")
            {
                logger.Debug(message);
            }

            if (lvl == "info")
            {
                logger.Info(message);
            }

            if (lvl == "warn")
            {
                logger.Warn(message);
            }

            if (lvl == "error")
            {
                logger.Error(message);
            }

            if (lvl == "fatal")
            {
                logger.Fatal(message);
            }
        }
    }
}
